3d8c8a7d659ff60b897d191c46f8e2ce4291c836,android-networking/src/main/java/com/androidnetworking/internal/InternalRunnable.java,InternalRunnable,goForUploadRequest,#,141
Before Change
ANData data = null;
try {
data = InternalNetworking.performUploadRequest(request);
if (data == null) {
return;
}
if (data.code == 304) {
request.finish();
return;
}
if (data.code >= 400) {
ANError anError = new ANError(data);
anError = request.parseNetworkError(anError);
anError.setErrorCode(data.code);
anError.setErrorDetail(ANConstants.RESPONSE_FROM_SERVER_ERROR);
deliverError(request, anError);
return;
}
ANResponse response = request.parseResponse(data);
After Change
private void goForUploadRequest() {
Response okHttpResponse = null;
try {
okHttpResponse = InternalNetworking.performUploadRequest(request);
if (okHttpResponse == null) {
ANError anError = new ANError();
anError = request.parseNetworkError(anError);
anError.setErrorDetail(ANConstants.CONNECTION_ERROR);
anError.setErrorCode(0);
deliverError(request, anError);
return;
}
if (request.getResponseAs() == RESPONSE.OK_HTTP_RESPONSE) {
request.deliverOkHttpResponse(okHttpResponse);
return;
}
if (okHttpResponse.code() >= 400) {
ANError anError = new ANError(okHttpResponse);
anError = request.parseNetworkError(anError);
anError.setErrorCode(okHttpResponse.code());
anError.setErrorDetail(ANConstants.RESPONSE_FROM_SERVER_ERROR);
deliverError(request, anError);
return;
}
ANResponse response = request.parseResponse(okHttpResponse);
if (!response.isSuccess()) {
deliverError(request, response.getError());